home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
ebl407px.zip
/
BATDOC2.BAT
< prev
next >
Wrap
DOS Batch File
|
1992-01-15
|
52KB
|
1,365 lines
bat * Loading HELP and DOCUMENTATION part 2
* Written by F.Canova 10/5/83 through 01/15/92
* (c) Copyright 1983 to 1992 by Seaware Corp. all rights reserved.
* This batch file REQUIRES EBL PLUS for proper execution!
**** NOTE! NOTE! NOTE! NOTE! ****
RAM |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
if %G = .goto. then %G = | goto -%F
beep type Error! Begin by using BATDOC first!
type This file is an overlay to BATDOC.
exit
-opt0 %F = opt0 | skip 3
-line0 %F = line0 | skip 2
-line599 %F = line599 | skip 1
-line1404 %F = line1404
%G = .goto.
color 8f |type Loading part 1 ...
leave
batdoc
-header * Routine prints general purpose header for help text
stack.purge |* remove any pre-typed keystrokes.
%n = %i $ 1 ( %i # - 2 ) & . & ( %i $ ( %i # - 1 ) 2 ) |* extract section # from page #
color( white on black )
cls
color( white on cyan )
window( 1, 1, 79, 3, Combo)
begtype
\%H Page \%n
\07 Press: PGDN for next page, PGUP for prev page, HOME for main menu.
end
color( white on black)
colorchar ~ as color(yellow on black)
window( 1, 5, 79, 25, Combo)
return
-scroll * Routine accepts key for scrolling help text
%e = 0
inkey %k
if %k = KEY("Ctrl-C") then goto -opt0
if %k = KEY(Esc) %i = 0 | goto -line0
if %k = KEY(Home) %i = 0 | goto -line0
if %k = KEY(Pgup) %i = %i - 1 | cls | %F = line%i | goto -%F
if %k = KEY(Pgdn) %i = %i + 1 | cls | %F = line%i | goto -%F
goto -scroll |* ignore any other key.
* ROUTINE TO HAVE USER GIVE A COMMAND A TRY !!
* %A = string which must match
-tryit
begtype
Enter your guess! ;
end
-tryit.loop
if .%a = . goto -tryit.solved.it |* end of string ?
%b = %a $ 1 1 |* get 1st letter
%a = %a $ 2 |* remove it from string
-tryit.retry
inkey %k |* get a key.
if %k = KEY(" ") type %b; | goto -tryit.loop
if %k = KEY(ESC) type %b%a| goto -tryit.give.up
if %k = %b type %k; | goto -tryit.loop
beep goto -tryit.retry
-tryit.solved.it
begtype
EXCELLENT !! - that's exactly it!
end
read Press the ─┘ key to continue to next section.....
return
-tryit.give.up
begtype
That's the answer you needed! (You can "peek" at part of
the answer next time by pressing the space bar if you'd like.)
end
read Press the ─┘ key to continue to next section.....
return
-opt6
-line503 %i = 600
-line600 %H = "How to print" | call -header| begtype
The simplest thing to for Extended Batch Language to do is to print text
on the display. This is done by either of two commands, TYPE and BEGTYPE.
The TYPE command can be used for something as simple as saying hello!
For example, just put this in a batch file...
BAT * Hello example...
TYPE "HELLO THERE"
This is all that is needed. This command can be typed directly from DOS
(this is called immediate mode) or be entered into a file such as
"TRIAL.BAT" (this is called direct execution mode). To execute it as a BAT
program with the file, just type the file's name "TRIAL" from DOS and you
will see the results of the program "HELLO THERE" coming from BAT.
Note that all EBL batch programs start with the word "BAT" and an optional
comment. This is always needed. For simplicity, we won't show it much in
the upcoming examples, but using it is necessary to tell DOS that future
commands are understood by EBL-Plus.
end
goto -scroll
-line601 call -header | begtype
You can also put DOS variables into this command to display their
contents. For example, if the "TRIAL.BAT" file contained the line:
TYPE "HELLO THERE" %1 %2
Then when we start the BAT program from DOS, we might enter:
TRIAL COMPUTER USER
DOS will automatically store the words after the program name into its
variables. Therefore, in the TYPE command, we will see contents of these
variables on the screen. The resulting message would be:
HELLO THERE COMPUTER USER
end
goto -scroll
-line602 call -header | begtype
There is a second method of putting text onto the display. This is with
the BEGTYPE command. Although it will not display the contents of
variables, it is very useful for displaying large blocks of text, such as
menus. For example, if the "TRIAL.BAT" file contains:
BAT BEGTYPE
This is a large block of text. It is useful for menus. Note
that Upper/Lower case characters are displayed intact here.
The block is always ended with "END" in the first column
after the text finishes.
END
When executed, the "TRIAL.BAT" program will display:
This is a large block of text. It is useful for menus. Note
that Upper/Lower case characters are displayed intact here.
The block is always ended with "END" in the first column
after the text finishes.
end
goto -scroll
-line603 call -header | begtype
The easiest way to add color to menus is to first use the COLORCHAR command
to make a character represent a color change. Then, every time that character
is used within the BEGTYPE block, future text will be highlighted with
the new color. A space will be added where each color change occurs.
This technique is useful for both BEGTYPE and TYPE commands.
BAT * BEGTYPE color sample ...
ColorChar @ as Color(Yellow)
BEGTYPE
@This@is highlighted
End
Type "So is@this!@"
and after running the EBL program we see...
~This~is highlighted
So is~this!~
end
goto -scroll
-line699 %i = 604
-line604 call -header | begtype
There is an additional advantage to using BEGTYPE command. This command
can also highlight text to the user. This is done by using the form:
[\\hex] within the text block.
For example if the text block contained \\0F within the text, the result
would be ~ High Intensity Text ! ~.
By choosing different values, the screen attributes can be controlled to
create inverted video, blinking, underlined, and very colorful text.
You can also display the contents of variables by using [\\%Var.name] in
the text block. For instance, if the variable %0 is to be printed, use \\%0
within the text after the BEGTYPE command.
An additional command CLS can be used to clear the display before
printing data. For instance, the combination "BAT CLS BEGTYPE" is quite
useful for printing menus and text such as this screen.
end
goto -scroll
-line604
begtype
~NOW IT'S YOUR TURN !!!~
If the ~%4~ variable contains the word ~DAY~, what is the command to display
the words "~FUN DAY~" on the display?
end
%A = "TYPE FUN %4" | Call -tryit
-opt7
-line605 %i = 700
-line700 %H = "Reading things from user" | call -header | begtype
In order to get input from the user, there are two available commands,
READ and INKEY.
When the command word READ is seen in the batch file, an input line is
accepted from the user. All function keys are assigned to the normal DOS
edit functions. When ENTER is pressed, the input line is assigned to DOS
variables.
Each word will be assigned in order to the variables indicated after the
READ command. When there are no more variables after the READ command to
assign, the remainder of the response is thrown away. If there are more
variables to be assigned after the READ command than there are words from
the user, these variables will be cleared out to a empty state. For
example:
READ Please enter your name ==> %1 %2
This would prompt the user and wait for him to enter two words. These
words will be saved in the %1 and %2 variables.
end
goto -scroll
-line701 call -header | begtype
Note that there does not have to be any variables indicated after the
command READ. In this case, EBL would wait for the enter key, throw away
any response, then continue to process the next batch file command.
end
goto -scroll
-line702 call -header | begtype
In the event that you wish to get a single keystroke from the user, the
INKEY command should be used.
This command will wait for the user to enter a single key on the keyboard
and return its value in the optional variable. This key can be not